home *** CD-ROM | disk | FTP | other *** search
-
-
-
- GETRLIMIT(3) MINTLIB LIBRARY FUNCTIONS GETRLIMIT(3)
-
-
- N✓NA✓AM✓ME✓E
- getrlimit, setrlimit - control maximum system resource
- con- sumption
-
- S✓SY✓YN✓NO✓OP✓PS✓SI✓IS✓S
- #include <sys/time.h>
- #include <sys/resource.h>
-
- int getrlimit(int kind, struct rlimit *rlp);
-
- int setrlimit(int kind, struct rlimit *rlp);
-
- D✓DE✓ES✓SC✓CR✓RI✓IP✓PT✓TI✓IO✓ON✓N
- Limits on the consumption of system resources by the cur-
- rent process and each process it creates may be obtained
- with the getrlimit call, and set with the setrlimit call.
- These functions only work for real if MiNT is active.
-
- The following resource parameters are allowed:
-
- RLIMIT_CPU the maximum amount of cpu time (in
- milliseconds) to be used by each process.
-
- RLIMIT_FSIZE the largest size, in bytes, of any single
- file that may be created.
-
- RLIMIT_DATA the maximum size, in bytes, of the data
- the process may allocate with Malloc.
-
- RLIMIT_STACK the maximum size, in bytes, of the stack
- segment for a process.
-
- RLIMIT_CORE the largest size, in bytes, of a core file
- that may be created.
-
- RLIMIT_RSS the maximum size, in bytes, allowed for
- the process.
-
- Of these, only the RLIMIT_CPU, RLIMIT_DATA and RLIMIT_RSS
- parameters are supported. The others do nothing. The UN*X
- parameter RLIMIT_NOFILE is not available in the header
- file at all. Also, the value of the RLIMIT_CPU parameter
- is in milliseconds, while the UN*X version is specified in
- seconds.
-
- A resource limit is specified as a soft limit and a hard
- limit. When a soft limit is exceeded a process receives a
- signal SIGXCPU if the cpu time is exceeded; memory alloca-
- tions will fail if RLIMIT_DATA or RLIMIT_RSS is exceeded.
- Hard limits are not enforced at all.
-
- The struct rlimit is defined as follows:
- struct rlimit
- {
-
-
-
- MiNT docs 0.1 3 March 1993 1
-
-
-
-
-
- GETRLIMIT(3) MINTLIB LIBRARY FUNCTIONS GETRLIMIT(3)
-
-
- long rlim_cur; /* current (soft) limit */
- long rlim_max; /* hard limit (not supported) */
- };
-
- Contradicting the UN*X version, any process may increase
- its limits at will.
-
- An "infinite" value for a limit is defined as
- RLIM_INFINITY (0x7fffffff).
-
- R✓RE✓ET✓TU✓UR✓RN✓N V✓VA✓AL✓LU✓UE✓ES✓S
- getrlimit and setrlimit return:
-
- 0 on success. -1 on failure; errno is set to EINVAL.
-
- S✓SE✓EE✓E A✓AL✓LS✓SO✓O
- P✓Ps✓se✓et✓tl✓li✓im✓mi✓it✓t(✓(2✓2)✓),✓, g✓ge✓et✓tr✓ru✓us✓sa✓ag✓ge✓e(✓(3✓3)✓),✓, s✓si✓ig✓gn✓na✓al✓l(✓(3✓3)✓)
-
- B✓BU✓UG✓GS✓S
- These functions are so different from their UN*X equiva-
- lents that they are practically worthless.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MiNT docs 0.1 3 March 1993 2
-
-
-